//
//  Cell03.m
//  LastTemp
//
//  Created by dllo on 15/4/24.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "Cell03.h"

@implementation Cell03
- (void)dealloc
{
    [_awardsLabel release];
    [_awards release];
    [_brief release];
    [_briefLabel release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.brief = [[UILabel alloc] init];
        self.brief.numberOfLines = 0;
        self.brief.font = [UIFont systemFontOfSize:16];
        [self.brief sizeToFit];
        [self.contentView addSubview:self.brief];
        [_brief release];
        
        self.briefLabel = [[UILabel alloc] init];
        self.briefLabel.font = [UIFont systemFontOfSize:20];
        [self.contentView addSubview:self.briefLabel];
        [_briefLabel release];
        
        self.awards = [[UILabel alloc] init];
        self.awards.numberOfLines = 0;
        [self.awards sizeToFit];
        self.awards.font = [UIFont systemFontOfSize:16];
        [self.contentView addSubview:self.awards];
        [_awards release];
        
        self.awardsLabel = [[UILabel alloc] init];
        self.awardsLabel.font = [UIFont systemFontOfSize:20];
        [self.contentView addSubview:self.awardsLabel];
        [_awardsLabel release];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:18],NSFontAttributeName, nil];
    CGRect rect = [self.brief.text boundingRectWithSize:CGSizeMake(375, 400) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    
    NSDictionary *dic1 = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:18],NSFontAttributeName, nil];
    CGRect rect1 = [self.awards.text boundingRectWithSize:CGSizeMake(375, 400) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic1 context:nil];
    
    self.brief.frame = CGRectMake(10, 40, self.contentView.frame.size.width - 20, rect.size.height);
    self.briefLabel.frame = CGRectMake(0, 0, 100, 40);
//    self.brief.frame = CGRectMake(5, 50, self.contentView.frame.size.width, 200);
    self.awardsLabel.frame = CGRectMake(0, rect.size.height + 40, 100, 40);
//    self.awards.frame = CGRectMake(5, 300, self.contentView.frame.size.width, 200);
    self.awards.frame = CGRectMake(10, rect.size.height + 80, self.contentView.frame.size.width - 20, rect1.size.height);
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
